<!doctype html>

<style>
    body { counter-reset: x 0; }

    div {
        counter-increment: inherit;
    }

    div:before {
        content: counter(x);
    }
</style>

<div></div>
